package com.ar4j.bench.test;

import javax.sql.DataSource;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.transaction.TransactionConfiguration;
import org.springframework.transaction.annotation.Transactional;

import com.ar4j.bench.test.util.TestUtils;

/**
 * Resets the ar4j benchmark test database, should be the first test to run in a test suite.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "/applicationContext-junit.xml" })
@TransactionConfiguration(transactionManager = "txManager", defaultRollback = false)
@Transactional
public class DatabaseReset {

  @Autowired
  private DataSource dataSource;
  
  @Test
  public void resetDatabase() {
    TestUtils.runDatabaseResetScript(dataSource);
  }

}
